# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Dataflow.V1b3.Model.LeaseWorkItemRequest do
  @moduledoc """
  Request to lease WorkItems.

  ## Attributes

  *   `currentWorkerTime` (*type:* `DateTime.t`, *default:* `nil`) - The current timestamp at the worker.
  *   `location` (*type:* `String.t`, *default:* `nil`) - The [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that contains the WorkItem's job.
  *   `projectNumber` (*type:* `String.t`, *default:* `nil`) - Optional. The project number of the project this worker belongs to.
  *   `requestedLeaseDuration` (*type:* `String.t`, *default:* `nil`) - The initial lease period.
  *   `unifiedWorkerRequest` (*type:* `map()`, *default:* `nil`) - Untranslated bag-of-bytes WorkRequest from UnifiedWorker.
  *   `workItemTypes` (*type:* `list(String.t)`, *default:* `nil`) - Filter for WorkItem type.
  *   `workerCapabilities` (*type:* `list(String.t)`, *default:* `nil`) - Worker capabilities. WorkItems might be limited to workers with specific capabilities.
  *   `workerId` (*type:* `String.t`, *default:* `nil`) - Identifies the worker leasing work -- typically the ID of the virtual machine running the worker.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :currentWorkerTime => DateTime.t() | nil,
          :location => String.t() | nil,
          :projectNumber => String.t() | nil,
          :requestedLeaseDuration => String.t() | nil,
          :unifiedWorkerRequest => map() | nil,
          :workItemTypes => list(String.t()) | nil,
          :workerCapabilities => list(String.t()) | nil,
          :workerId => String.t() | nil
        }

  field(:currentWorkerTime, as: DateTime)
  field(:location)
  field(:projectNumber)
  field(:requestedLeaseDuration)
  field(:unifiedWorkerRequest, type: :map)
  field(:workItemTypes, type: :list)
  field(:workerCapabilities, type: :list)
  field(:workerId)
end

defimpl Poison.Decoder, for: GoogleApi.Dataflow.V1b3.Model.LeaseWorkItemRequest do
  def decode(value, options) do
    GoogleApi.Dataflow.V1b3.Model.LeaseWorkItemRequest.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Dataflow.V1b3.Model.LeaseWorkItemRequest do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
